package com.xxxx.manager.service.impl;

import com.xxxx.manager.mapper.GoodsCategoryMapper;
import com.xxxx.manager.pojo.GoodsCategory;
import com.xxxx.manager.pojo.GoodsCategoryExample;
import com.xxxx.manager.service.GoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhoubin
 * @since 1.0.0
 */
@Service
public class GoodsCategoryServiceImpl implements GoodsCategoryService {
	@Resource
	private GoodsCategoryMapper goodsCategoryMapper;

	/**
	 * 查询所有商品分类
	 */
	@Override
	public List<GoodsCategory> selectAll() {
		GoodsCategoryExample goodsCategoryExample = new GoodsCategoryExample();

		return goodsCategoryMapper.selectByExample(goodsCategoryExample);
	}

	/**
	 * 查询一级商品分类
	 */
	@Override
	public List<GoodsCategory> selectOneCategory() {

		return goodsCategoryMapper.selectOneCategory();
	}

	/**
	 * 级联查询
	 */
	@Override
	public List<GoodsCategory> selectCategory(Short parentId) {

		return goodsCategoryMapper.selectCategoryByParentId(parentId);
	}
}
